<template>
  <div class="bottomDiv">
    <div :class="['itemDiv', activeIndex == index ? 'active' : '']" v-for="(item, index) in dataList" :key="index + 1" @click="changeActive(index, item)">
      <span>{{ item.name }}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: 'BottomVue',
  data() {
    return {
      dataList: [
        {
          img: '',
          name: '四全'
        },
        {
          img: '',
          name: '四制'
        },
        {
          img: '',
          name: '总览'
        },
        {
          img: '',
          name: '四预'
        },
        {
          img: '',
          name: '四管'
        }
      ],
      activeIndex: 2
    }
  },
  mounted() {
    if (this.$route.path == '/zlIndex') {
      this.activeIndex = 2
      this.$store.commit('changeStatus', '总览')
    } else if (this.$route.path == '/siguan') {
      this.activeIndex = 4
      this.$store.commit('changeStatus', '四管')
    } else if (this.$route.path == '/qzq') {
      this.activeIndex = 0
      this.$store.commit('changeStatus', '四全')
    }
  },
  methods: {
    changeActive(index, item) {
      if (item.name != '四管') {
        if (this.$route.path != '/zlIndex') {
          this.$router.push('/zlIndex')
        }
      } else {
        this.$router.push('/siguan')
      }
      this.activeIndex = index
      this.$store.commit('changeStatus', item.name)
    }
  }
}
</script>

<style lang="scss" scoped>
.bottomDiv {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 16vh;
  background: url('@/assets/img/bottomBg.png') no-repeat;
  background-size: 55% 78%;
  background-position: center bottom;
  padding: 0 33%;
  box-sizing: border-box;
  display: flex;
  justify-content: space-around;
  z-index: 990;
  .itemDiv {
    width: 20%;
    background: url('@/assets/img/common/bottomItemBg.png') no-repeat;
    background-size: 100% 100%;
    position: relative;
    cursor: pointer;
    span {
      font-family: Source Han Sans CN;
      font-weight: 500;
      font-size: 1vw;
      color: #ffffff;
      position: absolute;
      bottom: 13%;
      left: 35%;
    }
  }
  .active {
    background: url('@/assets/img/common/bottomItemBg2.png') no-repeat;
    background-size: 100% 100%;
    color: #f3b468;
  }
}
</style>
